// 默认数据
const defaultState = {
  inputValue : '',
  list:[
  ],

  ///
  guideStep: 1, // 引导步骤
  guided: false, // 是否已引导完成
}

export default (state = defaultState, action) => {

  // demo1上下文
  if (action.type === 'demo1Context') {
    let newState = state
    newState.Demo1 = action.value
    return newState
  }

  // 输入框改变
  if (action.type === 'changeInput') {
    let newState = state
    newState.inputValue = action.value
    return newState
  }

  // 添加一条数据
  if (action.type === 'addItem' && state.inputValue) {
    let newState = state 
    newState.list.push(newState.inputValue)
    newState.inputValue = ''
    return newState
  }

  // 删除一条数据
  if (action.type === 'deleteItem' ) {
    let newState = state
    newState.list.splice(action.index, 1)
    return newState
  }

  return state
}